/*
自己选择的路 ,跪着也要走完。朋友们 , 虽然这个世界日益浮躁起来,只
要能够为了当时纯粹的梦想和感动坚持努力下去 , 不管其它人怎么样,我
们也能够保持自己的本色走下去。
To the world , you will be a person , but to a person , you
will be the world .                               ——AKPower
*/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <cstdio>
#include <string>
#include <stack>
#include <set>
#define IOS ios::sync_with_stdio(false), cin.tie(0)
using namespace std;
typedef long long ll;
const ll maxn = 1e5 + 100;
ll a[maxn][6];
ll f[5][maxn][17];
ll maxx[6];
ll n, m, k;
ll shoot[6];

ll find(ll i, ll l, ll r)
{
    ll t = log2(r - l + 1);
    return max(f[i][l][t], f[i][r - (1 << t) + 1][t]);
    // ll ans = 0;
    // for (ll j = t; j >= 0; j--)
    // {
    //     if (l + (1 << j) - 1 > r)
    //         continue;
    //     ans = max(ans, f[i][l][j]);
    //     l += (1 << j);
    // }
    // return ans;
}

int main()
{
    IOS;
    ll ans = 0;
    cin >> n >> m >> k;
    for (ll i = 1; i <= n; i++)
    {
        for (ll j = 0; j < m; j++)
        {
            cin >> a[i][j];
            f[j][i][0] = a[i][j];
        }
    }
    ll t = log2(n) + 1;
    for (ll j = 0; j < m; j++)
    {
        for (ll k = 1; k <= t; k++)
        {
            // f[j][i][0] = a[i][j];
            for (ll i = 1; i + (1 << k) - 1 <= n; i++)
            {
                f[j][i][k] = max(f[j][i + (1 << (k - 1))][k - 1], f[j][i][k - 1]);
            }
        }
    }
    ll cnt = 0, max_sh = 0;
    for (ll i = 1; i + max_sh <= n; i++)
    {
        ll r = i + max_sh;
        cnt = max_sh + 1;
        ll sum = 0;
        for (ll j = 0; j < m; j++)
        {
            maxx[j] = find(j, i, r);
            sum += maxx[j];
        }
        if (sum > k)
        {
            continue;
        }
        r++;
        while (r <= n)
        {
            sum = 0;
            for (ll j = 0; j < m; j++)
            {
                sum += max(maxx[j], a[r][j]);
            }
            if (sum <= k)
            {
                cnt++;
                for (ll j = 0; j < m; j++)
                    maxx[j] = max(maxx[j], a[r][j]);
            }
            else
            {
                break;
            }
            r++;
        }
        if (cnt > max_sh)
        {
            for (ll j = 0; j < m; j++)
            {
                shoot[j] = maxx[j];
            }
            max_sh = cnt;
        }
    }
    for (ll i = 0; i < m - 1; i++)
    {
        cout << shoot[i] << " ";
    }
    cout << shoot[m - 1] << endl;
    getchar();
    getchar();
    return 0;
}
